<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
    <caption>用户列表</caption>
    <tr>
        <th>用户名</th>
        <th>密码</th>
        <th>昵称</th>
    </tr>

</table>
<script>
    //准备一个数组 数组中包含3个用户对象, 对象中包括:用户名,密码,昵称
    //在页面中添加一个表格标签  把数组中的3个对象里面的数据展示到表格中
    let arr = [{username:"tom",password:"123456",nick:"汤姆"},
        {username:"jerry",password:"123456",nick:"杰瑞"},
        {username:"lucy",password:"123456",nick:"露西"}];
    let table = document.querySelector("table");
    for (let user of arr) {
        let tr = document.createElement("tr");
        let usernameTd = document.createElement("td");
        let passwordTd = document.createElement("td");
        let nickTd = document.createElement("td");
        usernameTd.innerText = user.username;
        passwordTd.innerText = user.password;
        nickTd.innerText = user.nick;
        tr.append(usernameTd,passwordTd,nickTd);
        table.append(tr);
    }

</script>
</body>
</html>